home *** CD-ROM | disk | FTP | other *** search
/ Inter.Net 55-1 / Inter.Net 55-1.iso / CBuilder / Setup / BCB / data.z / mbctype.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-02-09  |  2.8 KB  |  90 lines

  1. /*  mbctype.h
  2.  
  3.     Defines the mbctype macros.
  4.  
  5. */
  6.  
  7. /*
  8.  *      C/C++ Run Time Library - Version 9.0
  9.  *
  10.  *      Copyright (c) 1997, 1998 by Borland International
  11.  *      All Rights Reserved.
  12.  *
  13.  */
  14. /* $Revision:   9.3  $ */
  15.  
  16. #ifndef __MBCTYPE_H
  17. #define __MBCTYPE_H
  18. #define _INC_MBCTYPE  /* MSC Guard name */
  19.  
  20. #ifndef ___STDDEF_H
  21. #include <_stddef.h>
  22. #endif
  23.  
  24. #ifndef __CTYPE_H
  25. #include <ctype.h>
  26. #endif
  27.  
  28. #define __MBBS ((unsigned char)0x01) /* Non-punctuation of single byte set   */
  29. #define __MBBP ((unsigned char)0x02) /* Punctuation of single byte set       */
  30. #define __MBB1 ((unsigned char)0x04) /* Legal 1st byte of double byte stream */
  31. #define __MBB2 ((unsigned char)0x08) /* Legal 2nd btye of double byte stream */
  32.  
  33. extern unsigned char _RTLENTRY _EXPDATA _mbctype[];    /* character type array */
  34.  
  35. /* values used in _mbbtype(), _mbsbtype() */
  36. #define _MBC_SINGLE       0
  37. #define _MBC_LEAD         1
  38. #define _MBC_TRAIL        2
  39. #define _MBC_ILLEGAL    (-1)
  40.  
  41. /* Japanese code page */
  42. #define _KANJI_CP 932
  43.  
  44. /* values used in _setmbcp() */
  45. #define _MB_CP_SBCS       0
  46. #define _MB_CP_OEM      (-2)
  47. #define _MB_CP_ANSI     (-3)
  48. #define _MB_CP_LOCALE   (-4)
  49.  
  50. #ifdef __cplusplus
  51. extern "C" {
  52. #endif
  53.  
  54. int _RTLENTRY _EXPFUNC _setmbcp(int newCodePage);
  55.  
  56. int _RTLENTRY _ismbbkalpha(unsigned int __c);
  57. int _RTLENTRY _ismbbkpunct(unsigned int __c);
  58. int _RTLENTRY _ismbbkana  (unsigned int __c);
  59. int _RTLENTRY _ismbbalpha (unsigned int __c);
  60. int _RTLENTRY _ismbbpunct (unsigned int __c);
  61. int _RTLENTRY _ismbbalnum (unsigned int __c);
  62. int _RTLENTRY _ismbbprint (unsigned int __c);
  63. int _RTLENTRY _ismbbgraph (unsigned int __c);
  64.  
  65. #ifndef __MBCS_LEADTRAIL
  66. #define __MBCS_LEADTRAIL
  67. int _RTLENTRY _ismbblead  (unsigned int __c);
  68. int _RTLENTRY _ismbbtrail (unsigned int __c);
  69. int _RTLENTRY _ismbslead  (const unsigned char _FAR *__s1, const unsigned char _FAR *__s2);
  70. int _RTLENTRY _ismbstrail (const unsigned char _FAR *__s1, const unsigned char _FAR *__s2);
  71. #endif  /* ! __MBCS_LEADTRAIL */
  72.  
  73. #ifdef __cplusplus
  74. }
  75. #endif
  76.  
  77. #define _ismbbkalpha(__c) ((_mbctype+1)[(unsigned char)(__c)] & __MBBS)
  78. #define _ismbbkpunct(__c) ((_mbctype+1)[(unsigned char)(__c)] & __MBBP)
  79. #define _ismbbkana(__c)   ((_mbctype+1)[(unsigned char)(__c)] &(__MBBS|__MBBP))
  80. #define _ismbbalpha(__c)  (isalpha((unsigned char)(__c)) || _ismbbkalpha(__c))
  81. #define _ismbbpunct(__c)  (ispunct((unsigned char)(__c)) || _ismbbkpunct(__c))
  82. #define _ismbbalnum(__c)  (isalnum((unsigned char)(__c)) || _ismbbkalpha(__c))
  83. #define _ismbbprint(__c)  (isprint((unsigned char)(__c)) || _ismbbkana(__c))
  84. #define _ismbbgraph(__c)  (isgraph((unsigned char)(__c)) || _ismbbkana(__c))
  85.  
  86. #define _ismbblead(__c)   ((_mbctype+1)[(unsigned char)(__c)] & __MBB1)
  87. #define _ismbbtrail(__c)  ((_mbctype+1)[(unsigned char)(__c)] & __MBB2)
  88.  
  89. #endif /* __MBCTYPE_H */
  90.